package com.xlx.openLink.snmp.snmpenum;

import com.xlx.openLink.enums.DevTypeEnum;
import jdk.nashorn.internal.runtime.Version;
import org.apache.commons.lang3.StringUtils;

public enum VersionEnum {
    version1("version1", "版本1", 0),
    version2c("version2c", "版本2", 1),
    version3("version3", "版本3", 2);


    private String code;
    private String desc;
    private Integer version;

    private VersionEnum(String code, String desc, Integer version) {
        this.code = code;
        this.desc = desc;
        this.version = version;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static VersionEnum getByVersion(Integer version) {
        if (version == null) {
            return null;
        }

        for (VersionEnum result : values()) {
            if (version == result.version) {
                return result;
            }
        }
        return null;
    }

}
